import { _decorator, Component, EPhysics2DDrawFlags, Node, PhysicsSystem2D } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Phy')
export class Phy extends Component {
        //是否开启物理引擎
        @property
        private isDebug:boolean = false;
    
    onLoad(){
        //开启物理引擎
        PhysicsSystem2D.instance.enable=true
        console.log(this.isDebug)
        if(this.isDebug){
            //开启物理引擎调试,绘制刚体的包围盒
            PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.All;
            console.log("开启物理引擎调试")
        }else{
            PhysicsSystem2D.instance.debugDrawFlags = EPhysics2DDrawFlags.None;
        }
    }
}

